
var Track = {
	number: function (e, supplier, id, createtime) {
		var s = id;
		var number = s.replace(/\s/g, '');
		
		// craneww 1236
		if (supplier == '793') {
			var url = 'http://76.8.142.228/WebTracker/ShipmentTracker?queryType=awbNo&queryValue=' + id;

			jswin(url, 'craneww', '800x600');
			return false;
		}
		
		// 顺丰 1231
		if (supplier == '788') {
			var url = 'http://www.sf-express.com/cn/sc/';

			jswin(url, 'sf', '800x600');
			return false;
		}
		
		// 圆通 1124
		if (supplier == '705') {
			var url = 'http://www.yto.net.cn/service/service.asp';

			jswin(url, 'sf', '800x600');
			return false;
		}
		
		// 振通物流 
		if (supplier == 'xxxx') {
			var url = 'http://www.alinknetwork.com/OnLine_Search.php?BillList=' + number;

			jswin(url, 'sf', '800x600');
			return false;
		}
		
		// 全峰物流
		if (supplier == '1294') {
			var url = 'http://k80.qfkd.com.cn/PublicInterface/showInfo.do?billcode=' + number;

			jswin(url, 'sf', '800x600');
			return false;
		}
		
		// dhl 1127
		if (supplier == '707') {			
			var d1 = this.dhl(number, createtime);
			var d2 = this.dhl2(number);
			
			var b1 = ['代理查看', 'url', 'jswin', '1024x600'];
			var b2 = ['直接查看', 'url', 'jswin', '1024x600'];
			
			var s = d1 + ", " + d2;
			
			return popup(e, [b1, b2], s);
		}
		
		// ups 1219
		if (supplier == '779') {
			var url = "express.php?do=PlanMy.ups&number={0}&express={1}";
			
			var d1 = url.format(number, supplier);
			// alert(d1);
			var d2 = this.ups(number);
			
			var b1 = ['站内查看', 'url', 'Common.dialog_view_', '800x500', '货运状态'];
			var b2 = ['站外查看', 'url', 'jswin', '1024x600'];
			
			var s = d1 + ", " + d2;
			
			return popup(e, [b1, b2], s);
		}
		
		// fedex 1125 1218
		if (supplier == '778') {
			var url = "express.php?do=PlanMy.fedex&number={0}&express={1}";
			
			var d1 = url.format(number, supplier);
			// alert(d1);
			var d2 = this.fedex(id);
			
			var b1 = ['站内查看', 'url', 'Common.dialog_view_', '800x500', '货运状态'];
			var b2 = ['站外查看', 'url', 'jswin', '800x600'];
			
			var s = d1 + ", " + d2;
			
			return popup(e, [b1, b2], s);
		}
		
		alert("正在开发中...");
		return false;
	},

	dhl: function (id, t) {
		var s = t;
		var d = s.replace(/\s/g, 'T');
		
		var date = new Date(d);	
		date.setDate(date.getDate() - 3);
		
		var now = new Date();
		now.setDate(now.getDate() + 1);
				
		var from = $.dateFormat.date(date, "{0}dd&{1}MM&{2}yyyy");	
		var to = $.dateFormat.date(now, "{0}dd&{1}MM&{2}yyyy");
		
		var s1 = from.format("fromDayValue=", "fromMonthValue=", "fromYearValue=");
		var s2 = to.format("toDayValue=", "toMonthValue=", "toYearValue=");
		
		var track_id = id;	
		var dhl = "http://www.cn.dhl.com/content/cn/zh/express/tracking/shippers_reference.shtml?shipperReference={0}&{1}&{2}"
		var ret = dhl.format(track_id.replace(/\s/g, ''), s1, s2);
			
		return ret;
	},

	dhl2: function (id) {
		var s = "http://www.cn.dhl.com/content/cn/zh/express/tracking.shtml?brand=DHL&AWB={0}";
		var ret = s.format(id);
		
		return ret;
	},

	ups: function (id) {
		var s = "http://wwwapps.ups.com/WebTracking/track?loc=zh_CN&HTMLVersion=5.0&loc=zh_CN&saveNumbers=null&track.x=%E8%BF%BD%E8%B8%AA&trackNums={0}";
		var ret = s.format(id);
		
		return ret;
	},

	fedex: function (id) {
		var s = "http://www.fedex.com/Tracking?action=1&ascend_header=1&clienttype=dotcomreg&clienttype=null&cntry_code=cn&cntry_code=cn&language=sim&language=null&mi=n&track=y&tracknumbers={0}";
		var ret = s.format(id);
		
		return ret;
	}
};
